<?php
	class chatlieudb
	{
		public function Add($TenChatLieu)
		{
			$sql = "INSERT INTO `tbl_chatlieu`(`TenChatLieu`) VALUES (".dataservice::slashes($TenChatLieu).")";
			$data = new dataservice();
			return $data->ExecuteNonQuery($sql);
		}
		
		public function Delete($MaChatLieu)
		{
			$sql = "DELETE FROM `tbl_chatlieu` WHERE `MaChatLieu` = $MaChatLieu";
			$data = new dataservice();
			return $data->ExecuteNonQuery($sql);
		}
		
		public function Update($MaChatLieu, $TenChatLieu)
		{
			$sql = "UPDATE `tbl_chatlieu` SET `TenChatLieu` = ".dataservice::slashes($TenChatLieu)." WHERE `MaChatLieu` = $MaChatLieu"; 
			$data = new dataservice();
			return $data->ExecuteNonQuery($sql);
		}
	
		public function GetList($MaChatLieu, $TenChatLieu)
		{
			$sql = "SELECT * FROM `tbl_chatlieu` WHERE 1";
			if($MaChatLieu!="")
				$sql .= " AND `MaChatLieu` = '$MaChatLieu' ";
			if($TenChatLieu!="")
				$sql .= " AND `TenChatLieu` LIKE '%$TenChatLieu%' ";
			$data = new dataservice();
			return $data->ExecuteQuery($sql);
		}
		public function Find($TenChatLieu)
		{
			$sql = "SELECT * FROM `tbl_chatlieu` WHERE 1";
			if($TenChatLieu!="")
				$sql = " SELECT * FROM `tbl_chatlieu` WHERE `TenChatLieu` LIKE '%$TenChatLieu%' ";
			$data = new dataservice();
			return $data->ExecuteQuery($sql);
		}
		
	}
?>